<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Calls a SOAP function</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.setsoapheaders.html">SoapClient::__setSoapHeaders</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.soapclient.html">SoapClient::SoapClient</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="soapclient.soapcall" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SoapClient::__soapCall</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.0.1)</p><p class="refpurpose"><span class="refname">SoapClient::__soapCall</span> &mdash; <span class="dc-title">Calls a SOAP function</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-soapclient.soapcall-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>SoapClient::__soapCall</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$function_name</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$arguments</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$input_headers</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$output_headers</code></span>
  ]]] )</div>

  <p class="para rdfs-comment">
   This is a low level API function that is used to make a SOAP call. Usually,
   in WSDL mode, SOAP functions can be called as methods of the
   <a href="class.soapclient.html" class="classname">SoapClient</a> object. This method is useful in non-WSDL
   mode when <em>soapaction</em> is unknown, <em>uri</em>
   differs from the default or when sending and/or receiving SOAP Headers.
  </p>
  <p class="para">
   On error, a call to a SOAP function can cause PHP to throw exceptions or return a
   <a href="class.soapfault.html" class="classname">SoapFault</a> object if exceptions are disabled.
   To check if the function call failed to catch the SoapFault exceptions,
   check the result with <span class="function"><a href="function.is-soap-fault.html" class="function">is_soap_fault()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-soapclient.soapcall-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">function_name</code></em></dt>

     <dd>

      <p class="para">
       The name of the SOAP function to call.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">arguments</code></em></dt>

     <dd>

      <p class="para">
       An array of the arguments to pass to the function. This can be either
       an ordered or an associative array. Note that most SOAP servers require
       parameter names to be provided, in which case this must be an
       associative array.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">options</code></em></dt>

     <dd>

      <p class="para">
       An associative array of options to pass to the client.
      </p>
      <p class="para">
       The <em>location</em> option is the URL of the remote Web service.
      </p>
      <p class="para">
       The <em>uri</em> option is the target namespace of the SOAP service.
      </p>
      <p class="para">
        The <em>soapaction</em> option is the action to call.
      </p>
    </dd>

    
    
     <dt>
<em><code class="parameter">input_headers</code></em></dt>

     <dd>

      <p class="para">
       An array of headers to be sent along with the SOAP request.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">output_headers</code></em></dt>

     <dd>

      <p class="para">
       If supplied, this array will be filled with the headers from the SOAP response.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-soapclient.soapcall-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   SOAP functions may return one, or multiple values. If only one value is returned
   by the SOAP function, the return value of <em>__soapCall</em> will be
   a simple value (e.g. an integer, a string, etc). If multiple values are
   returned, <em>__soapCall</em> will return
   an associative array of named output parameters.
  </p>
  <p class="para">
   On error, if the SoapClient object was constructed with the <em>exceptions</em>
   option set to <strong><code>FALSE</code></strong>, a SoapFault object will be returned.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-soapclient.soapcall-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5205">
    <p><strong>Example #1 <span class="function"><strong>SoapClient::__soapCall()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SoapClient</span><span style="color: #007700">(</span><span style="color: #DD0000">"some.wsdl"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">SomeFunction</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__soapCall</span><span style="color: #007700">(</span><span style="color: #DD0000">"SomeFunction"</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__soapCall</span><span style="color: #007700">(</span><span style="color: #DD0000">"SomeFunction"</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">SoapHeader</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">$output_headers</span><span style="color: #007700">);<br /><br /><br /></span><span style="color: #0000BB">$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SoapClient</span><span style="color: #007700">(</span><span style="color: #0000BB">null</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'location'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"http://localhost/soap.php"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'uri'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"http://test-uri/"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">SomeFunction</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__soapCall</span><span style="color: #007700">(</span><span style="color: #DD0000">"SomeFunction"</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__soapCall</span><span style="color: #007700">(</span><span style="color: #DD0000">"SomeFunction"</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'soapaction'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'some_action'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'uri'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'some_uri'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-soapclient.soapcall-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="soapclient.soapclient.html" class="methodname" rel="rdfs-seeAlso">SoapClient::SoapClient()</a> - SoapClient constructor</span></li>
    <li class="member"><span class="methodname"><a href="soapparam.soapparam.html" class="methodname" rel="rdfs-seeAlso">SoapParam::SoapParam()</a> - SoapParam constructor</span></li>
    <li class="member"><span class="methodname"><a href="soapvar.soapvar.html" class="methodname" rel="rdfs-seeAlso">SoapVar::SoapVar()</a> - SoapVar constructor</span></li>
    <li class="member"><span class="methodname"><a href="soapheader.soapheader.html" class="methodname" rel="rdfs-seeAlso">SoapHeader::SoapHeader()</a> - SoapHeader constructor</span></li>
    <li class="member"><span class="methodname"><a href="soapfault.soapfault.html" class="methodname" rel="rdfs-seeAlso">SoapFault::SoapFault()</a> - SoapFault constructor</span></li>
    <li class="member"><span class="function"><a href="function.is-soap-fault.html" class="function" rel="rdfs-seeAlso">is_soap_fault()</a> - Checks if a SOAP call has failed</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.setsoapheaders.html">SoapClient::__setSoapHeaders</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.soapclient.html">SoapClient::SoapClient</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
